package com.mcflies.aotoPartsManager.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;

import com.mcflies.aotoPartsManager.dao.AutoPartsBaseDAO;
import com.mcflies.aotoPartsManager.dao.LeftMenuTreeConfigDAO;
import com.mcflies.aotoPartsManager.pojo.LeftMenuTreeConfig;

public class LeftMenuTreeConfigDAOImpl extends AutoPartsBaseDAO implements LeftMenuTreeConfigDAO {
	private Logger log = Logger.getLogger(LeftMenuTreeConfigDAOImpl.class);

	@SuppressWarnings("unchecked")
	@Override
	public List<LeftMenuTreeConfig> loadLeftMenuTreeConfig() throws Exception {
		List<LeftMenuTreeConfig> treeList = new ArrayList<LeftMenuTreeConfig>();
		try {
			Session session = openDBSession();
			String sql = "from LeftMenuTreeConfig";
			Query query = session.createQuery(sql);
			treeList = query.list();
			return treeList;
		} catch (Exception e) {
			log.info("在[" + LeftMenuTreeConfigDAOImpl.class.getName() + "]执行方法(loadLeftMenuTreeConfig)发生：："
					+ e.getMessage() + "异常");
		}
		return treeList;
	}
}
